import * as actionTypes from "./constants";

import { Map } from "immutable";

const defaultState = Map({
  topBanners: [],
  hotRecommends: [],
  newAlbums: [],
  //获取一个歌单
  songList: [],
});

function reducer(state = defaultState, action) {
  switch (action.type) {
    case actionTypes.TOP_BANNER_ACTION:
      return state.set("topBanners", action.topBanners);
    case actionTypes.RECPMMEND_ACTION:
      return state.set("hotRecommends", action.hotRecommends);
    case actionTypes.NEWALBUMS_ACTION:
      return state.set("newAlbums", action.newAlbums);
    case actionTypes.GET_SONG_LIST_ACTION:
      return state.set("songList", action.songList);
    default:
      return state;
  }
}

export default reducer;
